package com.xujianlun.cpms.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.service.Contact;
/**
 * @version 1.0
 * @Author xujianlun
 * @Date 2022/5/9 22:10
 * @注释  文档接口 url(http://localhost:8081/doc.html)
 */
@Configuration
@EnableWebMvc
public class DocConfig {
    @Bean
    public Docket docket() {
        Docket docket = new Docket(DocumentationType.OAS_30)
                .apiInfo(new ApiInfoBuilder()
                        .title("去哪儿旅游小程序后台管理系统")
                        .description("去哪儿旅游微信小程序后台接口")
                        .contact(new Contact("徐健伦", "http://localhost:8081", "2306615038@qq.com"))
                        .version("1.0")
                        .build())
                // 分组名称
                .groupName("all")
                .select()
                // 这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.xujianlun.cpms.controller"))
                .paths(PathSelectors.any())
                .build();

        return docket;
    }
}
